﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BloomsburyBanHang.DTO
{
    public class HoaDonDTO
    {
        private int maHoaDon;

        private String tenDangNhap;

        public String TenDangNhap
        {
            get { return tenDangNhap; }
            set { tenDangNhap = value; }
        }
        private DateTime ngayDatHang;

        public DateTime NgayDatHang
        {
            get { return ngayDatHang; }
            set { ngayDatHang = value; }
        }
        private DateTime ngayGiaoHang;

        public DateTime NgayGiaoHang
        {
            get { return ngayGiaoHang; }
            set { ngayGiaoHang = value; }
        }
        private float tongTien;

        public float TongTien
        {
            get { return tongTien; }
            set { tongTien = value; }
        }
        private int maNhaVanChuyen;

        public int MaNhaVanChuyen
        {
            get { return maNhaVanChuyen; }
            set { maNhaVanChuyen = value; }
        }
        private int maNganHang;

        public int MaNganHang
        {
            get { return maNganHang; }
            set { maNganHang = value; }
        }

        public int MaHoaDon
        {
            get { return maHoaDon; }
            set { maHoaDon = value; }
        }

        public static HoaDonDTO Convert(HOA_DON hd)
        {
            HoaDonDTO hoadon = new HoaDonDTO();
            hoadon.MaHoaDon = hd.MaHoaDon;
            hoadon.maNganHang = (int)hd.MaNganHang;
            hoadon.maNhaVanChuyen = (int)hd.MaNhaVanChuyen;
            hoadon.NgayDatHang = (DateTime)hd.NgayDatHang;
            hoadon.NgayGiaoHang = (DateTime)hd.NgayGiaoHang;
            hoadon.TenDangNhap = hd.TenDangNhap;
            hoadon.TongTien = (float)hd.TongTien;
            return hoadon;
        }
        public static List<HoaDonDTO> ListConvert(List<HOA_DON> lst)
        {
            List<HoaDonDTO> result = new List<HoaDonDTO>();
            for (int i = 0; i < lst.Count; i++)
            {
                result.Add(Convert(lst[i]));
            }
            return result;
        }
    }
}